home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / Networking / ARPSample1.0b1 / ARPerations.h < prev    next >
Encoding:
Text File  |  1997-04-03  |  3.9 KB  |  97 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        ARPerations.h
  3.  
  4.     Contains:    Interface to the standard ARP operations.
  5.  
  6.     Written by:    Quinn "The Eskimo!"
  7.  
  8.     Copyright:    © 1997 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.     You may incorporate this sample code into your applications without
  13.     restriction, though the sample code has been provided "AS IS" and the
  14.     responsibility for its operation is 100% yours.  However, what you are
  15.     not permitted to do is to redistribute the source as "DSC Sample Code"
  16.     after having made changes. If you're going to re-distribute the source,
  17.     we require that you make it clear in the source that the code was
  18.     descended from Apple Sample Code, but that you've made changes.
  19. */
  20.  
  21. ///////////////////////////////////////////////////////////////////
  22. // Pick up the standard UInt32 and Handle types.
  23.  
  24. #include <Types.h>
  25.  
  26.  
  27. OSStatus ARPGetCacheReport(Handle cacheReport);
  28.     // Gets a report about the contents of the ARP
  29.     // cache in standard Macintosh 'TEXT' format.
  30.     // You must create the handle before calling this routine
  31.     // and dispose it after it returns.  The routine will
  32.     // resize as appropriate.
  33.  
  34.  
  35. OSStatus ARPAddEntry(char *interfaceName,
  36.                         UInt32 arpProto,
  37.                         UInt32 flags,
  38.                         void *protoAddress, UInt32 protoSize, void *protoMask,
  39.                         void *hardwareAddress, UInt32 hardwareSize);
  40.     // Add an entry to the ARP cache for the given
  41.     // interface.  arpProto is the ARP
  42.     // protocol type, typically IP_ARP_PROTO_TYPE for 
  43.     // IP ARP.  See "OTARPModule.h" for
  44.     // a description of the flags parameter.  protoAddress
  45.     // is a pointer to the protocol address.  protoSize
  46.     // is the length of the protocol address.  These would
  47.     // normally be &InetHost and sizeof(InetHost) respectively.
  48.     // protoMask is a pointer to the protocol mask for this
  49.     // entry.  Normally you would pass a protoMask of $FFFFFFFF.
  50.     // I'm not sure what other values do.  hardwareAddress
  51.     // and hardwareSize specify the hardware address for the
  52.     // entry.  For an Ethernet-style interface, these are
  53.     // a pointer to the Ethernet address and 6 respectively.
  54.  
  55. OSStatus ARPDeleteEntry(char *interfaceName,
  56.                         UInt32 arpProto,
  57.                         void *protoAddress, UInt32 protoSize);
  58.     // Delete an entry from the ARP cache for the given
  59.     // interface.
  60.     // arpProto is the ARP protocol type, typically IP_ARP_PROTO_TYPE
  61.     // for IP ARP.
  62.     // protoAddress and protoSize specify the
  63.     // protocol address of the entry to delete.  These would
  64.     // normally be &InetHost and sizeof(InetHost) respectively.
  65.     
  66. OSStatus ARPCacheQuery(char *interfaceName,
  67.                         UInt32 arpProto,
  68.                         void *protoAddress, UInt32 protoSize,
  69.                         void *hardwareAddress, UInt32 hardwareSize, UInt32 *flags);
  70.     // Look up an entry in the ARP cache for a given
  71.     // interface.    
  72.     // arpProto is the ARP protocol type, typically IP_ARP_PROTO_TYPE
  73.     // for IP ARP.
  74.     // protoAddress and protoSize specify the
  75.     // protocol address of machine you are looking up.  These would
  76.     // normally be &InetHost and sizeof(InetHost) respectively.
  77.     // You should set hardwareAddress to point to a buffer 
  78.     // where the hardware address is returned.  You should give
  79.     // the size of the buffer in hardwareSize.  You should set
  80.     // flags to point to a buffer where the ARP cache entry's
  81.     // flags are returned.  See "OTARPModule.h" for
  82.     // a description of the possible flag values.
  83.  
  84. OSStatus ARPInterfaceUp(char *configString, UInt32 *interfaceCookie);
  85.     // Bring an ARP interface up.  configString is the
  86.     // name of the port over which to bring the interface up, ie
  87.     // the name you would pass to OTCreateConfiguration to address
  88.     // that port.  Aliases, such as "enet", are allowed.
  89.     // The UInt32 pointed to by interfaceCookie is set to a
  90.     // value you can pass to ARPInterfaceDown to tear the
  91.     // interface down.
  92.  
  93. OSStatus ARPInterfaceDown(UInt32 interfaceCookie);
  94.     // Tear an ARP interface down.  interfaceCookie is the
  95.     // value you got from ARPInterfaceUp when you brought the
  96.     // interface up.
  97.